| scientistID | county_name | recorded_temp |
|---|---|---|
| #74991 | Lyon County | 21.1 |
| #22780 | Dubuque County | 28.9 |
| #55325 | Crawford County | 26.4 |
| #46379 | Allamakee County | 27.1 |
| #84259 | Jones County | 34.2 |
Visualising Uncertainty
Department of Econometrics and Business Statistics
| scientistID | county_name | recorded_temp |
|---|---|---|
| #74991 | Lyon County | 21.1 |
| #22780 | Dubuque County | 28.9 |
| #55325 | Crawford County | 26.4 |
| #46379 | Allamakee County | 27.1 |
| #84259 | Jones County | 34.2 |
990 citizen scientists participated
| county_name | temp_mean | temp_se | n |
|---|---|---|---|
| Adair County | 29.7 | 0.907 | 6 |
| Adams County | 29.6 | 1.003 | 9 |
| Allamakee County | 26.3 | 0.550 | 8 |
| Appanoose County | 22.8 | 0.831 | 14 |
| Audubon County | 27.6 | 0.893 | 11 |
| county_name | temp_mean | low_temp_se | high_temp_se | n | county_geometry |
|---|---|---|---|---|---|
| Adair County | 29.7 | 0.907 | 2.72 | 6 | MULTIPOLYGON (((441130 -374... |
| Adams County | 29.6 | 1.003 | 3.01 | 9 | MULTIPOLYGON (((424556 -414... |
| Allamakee County | 26.3 | 0.550 | 1.65 | 8 | MULTIPOLYGON (((675217 -131... |
Make the high and low variance choropleth maps yourself, and see why they come out looking identical
ggdibbler
Vizumap
biscale
Vizumap
ggplot2 flexibility is lost
ggdibblerggplot2 uses the grammar of graphicsggdibbler is forggdibbler Exampleggplot(toy_temp_dist) +
geom_sf_sample(aes(geometry=county_geometry, fill=temp_dist), linewidth=0, n=7) +
geom_sf(aes(geometry = county_geometry), fill=NA, linewidth=0.5, colour="white") +
theme_minimal() +
scale_fill_distiller(palette = "YlOrRd", direction= 1) +
xlab("Longitude") +
ylab("Latitude") +
labs(fill = "Temperature") +
ggtitle("A super cool and customised plot")ggplot(toy_temp_dist) +
geom_sf_sample(aes(geometry=county_geometry, fill=temp_dist), linewidth=0, n=7) +
geom_sf(aes(geometry = county_geometry), fill=NA, linewidth=0.5, colour="white") +
theme_minimal() +
scale_fill_distiller(palette = "YlOrRd", direction= 1) +
xlab("Longitude") +
ylab("Latitude") +
labs(fill = "Temperature") +
ggtitle("A super cool and customised plot")Here is the code that was used to make the cartogram from earlier in the session. Can you make a ggdibbler verion of this plot?
# Transform to a the crs needed to do the cartogram transformation
toy_merc <- st_transform(toy_temp_mean, 3857)
# cartogram transformation
toy_cartogram <- cartogram_cont(toy_merc, weight = "n", itermax = 5)
# Transform back to original crs
toy_cartogram <- st_transform(toy_cartogram, st_crs(toy_temp_mean))
# Plot cartogram using ggplot2
ggplot(toy_cartogram) +
geom_sf(aes(fill = temp_mean), linewidth = 0, alpha = 0.9) +
theme_minimal() +
scale_fill_distiller(palette = "YlOrRd", direction= 1) +
xlab("Longitude") +
ylab("Latitude") +
labs(fill = "Temperature") +
theme(aspect.ratio=0.7)# only change to data is distribution
toy_cartogram |>
mutate(temp_dist = distributional::dist_normal(temp_mean, temp_se^2)) |>
ggplot() +
geom_sf_sample(aes(geometry=county_geometry,
fill=temp_dist), linewidth=0) +
geom_sf(aes(geometry=county_geometry), fill=NA, colour="white") +
theme_minimal() +
scale_fill_distiller(palette = "YlOrRd", direction= 1) +
xlab("Longitude") +
ylab("Latitude") +
labs(fill = "Temperature") +
theme(aspect.ratio=0.7)